import requests

#第一种方法
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"}
p = {"wd":"传播智课"}
# url_temp = "https://www.baidu.com/s?"
url_temp = "https://www.baidu.com/s" #有无？都不重要
r = requests.get(url=url_temp,headers=headers,params=p)
print(r.status_code)
print(r.request.url)

#第二种方法
# url = "https://www.baidu.com/s?wd={}".format("传播智课")
# r = requests.get(url=url,headers=headers)
# print(r.status_code)
# print(r.request.url)